﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TaoPortal.DataAccess;

namespace TaoPortal.BusinessLogic.Repository
{
    public abstract class BaseRepository 
    {
        public bool AutoCommit { get; set; }
        protected DataContext db { get; set; }
        public BaseRepository()
        {
            AutoCommit = true;
        }
        public void SaveChanges()
        {
            if (AutoCommit)
            {
                try
                {
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
    }
}
